package org.lc.design.samples.case1;

import org.lc.design.samples.case1.store.ICarManufacturing;
import org.lc.design.samples.case1.store.impl.MotorcycleManufacturingService;
import org.lc.design.samples.case1.store.impl.SedanManufacturingService;
import org.lc.design.samples.case1.store.impl.TruckManufacturingService;

import java.util.HashMap;
import java.util.Map;

/**
* 汽车制造工厂类
* @author lc
* @date 2024/3/26
*/
public class CarManufacturingFactory {

    private static final Map<String,ICarManufacturing> map = new HashMap<>();

    static {
        map.put("motorcycle",new MotorcycleManufacturingService());
        map.put("sedan",new SedanManufacturingService());
        map.put("truck",new TruckManufacturingService());
    }

    public static ICarManufacturing getCarManufacturingService(String carType) {
        return map.get(carType);
    }
}
